package cn.yuanqiao.archive.management.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 盘规格对象 YQPGG
 * 
 * @author sy
 * @date 2023-07-10
 */
public class YqPgg extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQPGG";

    public YqPgg() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
            throw new ServiceException("TenantCode is null");
//            this.tableName = "YQPGG";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQPGG";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 盘规格ID */
    @IdAnnotation
    private Long pggId;

    /** 载体类型ID */
    @Excel(name = "载体类型ID")
    private Long ztlxId;

    /** 组盘名称 */
    @Excel(name = "组盘名称")
    private String pggName;

    /** 盘规格大小（单位默认为MB） */
    @Excel(name = "盘规格大小", readConverterExp = "单位默认为MB")
    private String size;

    /** 数量 */
    @Excel(name = "数量")
    private Integer quantity;

    /** 组盘状态 */
    @Excel(name = "组盘状态")
    private Integer state;

    /** 备注 */
    @Excel(name = "备注")
    private String remark;

    /** 创建人 */
    @Excel(name = "创建人")
    private Long creatorId;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /** 最后修改人 */
    @Excel(name = "最后修改人")
    private Long lastupdater;

    /** 最后修改时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastupdateTime;

    public void setPggId(Long pggId) 
    {
        this.pggId = pggId;
    }

    public Long getPggId() 
    {
        return pggId;
    }
    public void setZtlxId(Long ztlxId) 
    {
        this.ztlxId = ztlxId;
    }

    public Long getZtlxId() 
    {
        return ztlxId;
    }
    public void setPggName(String name)
    {
        this.pggName = name;
    }

    public String getPggName()
    {
        return pggName;
    }
    public void setSize(String size) 
    {
        this.size = size;
    }

    public String getSize() 
    {
        return size;
    }
    public void setQuantity(Integer quantity)
    {
        this.quantity = quantity;
    }

    public Integer getQuantity()
    {
        return quantity;
    }
    public void setState(Integer state) 
    {
        this.state = state;
    }

    public Integer getState() 
    {
        return state;
    }

    @Override
    public String getRemark() {
        return remark;
    }

    @Override
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public void setCreatorId(Long creatorId)
    {
        this.creatorId = creatorId;
    }

    public Long getCreatorId()
    {
        return creatorId;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public void setLastupdater(Long lastupdater)
    {
        this.lastupdater = lastupdater;
    }

    public Long getLastupdater()
    {
        return lastupdater;
    }
    public void setLastupdateTime(Date lastupdateTime) 
    {
        this.lastupdateTime = lastupdateTime;
    }

    public Date getLastupdateTime() 
    {
        return lastupdateTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("pggId", getPggId())
            .append("ztlxId", getZtlxId())
            .append("name", getPggName())
            .append("size", getSize())
            .append("quantity", getQuantity())
            .append("state", getState())
            .append("creatorId", getCreatorId())
            .append("createTime", getCreateTime())
            .append("lastupdater", getLastupdater())
            .append("lastupdateTime", getLastupdateTime())
            .toString();
    }
}
